import { createRouter, createWebHistory } from 'vue-router'
import LoginView from '@/views/LoginView.vue'
import MainLayout from '@/layouts/MainLayout.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: LoginView
    },
    {
      path: '/',
      component: MainLayout,
      redirect: '/dashboard',
      children: [
        {
          path: '/dashboard',
          name: 'dashboard',
          component: () => import('@/views/dashboard/DashboardView.vue')
        },
        // 用户管理
        {
          path: '/users/list',
          name: 'user-list',
          component: () => import('@/views/users/UserListView.vue')
        },
        {
          path: '/users/profile/:id',
          name: 'user-profile',
          component: () => import('@/views/users/UserProfileView.vue')
        },
        {
          path: '/users/edit/:id',
          name: 'user-edit',
          component: () => import('@/views/users/UserEditView.vue')
        },
        {
          path: '/my-profile',
          name: 'my-profile',
          component: () => import('@/views/users/MyProfileView.vue')
        },
        // 公告管理
        {
          path: '/announcements/list',
          name: 'announcement-list',
          component: () => import('@/views/announcements/AnnouncementListView.vue')
        },
        {
          path: '/announcements/detail/:id',
          name: 'announcement-detail',
          component: () => import('@/views/announcements/AnnouncementDetailView.vue')
        },
        {
          path: '/announcements/create',
          name: 'announcement-create',
          component: () => import('@/views/announcements/AnnouncementCreateView.vue')
        },
        // 证书管理
        {
          path: '/certificates/list',
          name: 'certificate-list',
          component: () => import('@/views/certificates/CertificateListView.vue')
        },
        // 附加分审查
        {
          path: '/extra-review/list',
          name: 'extra-review-list',
          component: () => import('@/views/extra-review/ExtraReviewListView.vue')
        },
        {
          path: '/extra-review/students',
          name: 'extra-review-students',
          component: () => import('@/views/extra-review/StudentExtraListView.vue')
        },
        {
          path: '/extra-review/submit',
          name: 'extra-review-submit',
          component: () => import('@/views/extra-review/ExtraReviewSubmitView.vue')
        },
        {
          path: '/extra-review/detail/:id',
          name: 'extra-review-detail',
          component: () => import('@/views/extra-review/ExtraReviewDetailView.vue')
        },
        // 成绩管理
        {
          path: '/grades/list',
          name: 'grade-list',
          component: () => import('@/views/grades/GradeListView.vue')
        },
        {
          path: '/grades/student',
          name: 'student-grades',
          component: () => import('@/views/grades/StudentGradesView.vue')
        },
        {
          path: '/grades/view',
          name: 'grade-view',
          component: () => import('@/views/grades/GradeViewPage.vue')
        },
        {
          path: '/grades/import',
          name: 'grade-import',
          component: () => import('@/views/grades/GradeImportView.vue')
        },
        {
          path: '/grades/statistics',
          name: 'grade-statistics',
          component: () => import('@/views/grades/GradeStatisticsView.vue')
        },
        // 综测分管理
        {
          path: '/scores/list',
          name: 'score-list',
          component: () => import('@/views/scores/ScoreListView.vue')
        },
        {
          path: '/scores/detail/:id',
          name: 'score-detail',
          component: () => import('@/views/scores/ScoreDetailView.vue')
        },
        {
          path: '/scores/ranking',
          name: 'score-ranking',
          component: () => import('@/views/scores/ScoreRankingView.vue')
        },
        // 审查记录
        {
          path: '/review-records/list',
          name: 'review-record-list',
          component: () => import('@/views/review-records/ReviewRecordListView.vue')
        },
        // 系统管理
        {
          path: '/system/colleges',
          name: 'college',
          component: () => import('@/views/system/CollegeView.vue')
        },
        {
          path: '/system/majors',
          name: 'major',
          component: () => import('@/views/system/MajorView.vue')
        },
        {
          path: '/system/classes',
          name: 'classes',
          component: () => import('@/views/system/ClassesView.vue')
        },
        {
          path: '/system/courses',
          name: 'course',
          component: () => import('@/views/system/CourseView.vue')
        },
        {
          path: '/system/punish',
          name: 'punish',
          component: () => import('@/views/system/PunishView.vue')
        },
        {
          path: '/system/punish-dict',
          name: 'punish-dict',
          component: () => import('@/views/system/PunishDictView.vue')
        }
      ]
    }
  ]
})

export default router
